function varargout = pc_params(varargin)
% $Id: pc_params.m 430 2005-06-21 20:20:17Z edmaclin $
% PC_PARAMS Application M-file for pc_params.fig
%    FIG = PC_PARAMS launch pc_params GUI.
%    PC_PARAMS('callback_name', ...) invoke the named callback.

% Last Modified by GUIDE v2.5 04-May-2005 15:24:46
% $Log: pc_params.m,v $
% Revision 1.2  2004/07/07 18:07:24  odellj
% Fixed the 2 'low's to the top one being 'high' in * pass filter.
% Also prepped for logging.
%
% Revision 1.1  2004/07/06 20:10:16  odellj
% New pulse correction paramter menu with conversion: points <-> bpm
%

global hdr fig logid

if nargin == 0  % LAUNCH GUI

	fig = openfig(mfilename,'reuse');
    
	% Generate a structure of handles to pass to callbacks, and store it. 
	handles = guihandles(fig);
    
    set(handles.BeatHiPass_str,'String',num2str(hdr.BeatHiPass));
    set(handles.BeatLoPass_str,'String',num2str(hdr.BeatLoPass));
    set(handles.MinBeat_str,'String',num2str(hdr.min_BPM));
    set(handles.MaxBeat_str,'String',num2str(hdr.max_BPM));    
    set(handles.n_warp_str,'String',num2str(hdr.n_warp));

	guidata(fig, handles);

	if nargout > 0
		varargout{1} = fig;
	end

elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK

	try
		if (nargout)
			[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
		else
			feval(varargin{:}); % FEVAL switchyard
		end
	catch
		disp(lasterr);
	end

end

% --------------------------------------------------------------------
function varargout = BeatHiPass_str_Callback(h, eventdata, handles, varargin)

global hdr logid
Value = get(h,'String');
set(handles.BeatHiPass_str,'String',Value);
% fprintf(logid,'Writing the value %s to hdr.BeatHiPass\n',Value);
hdr.BeatHiPass = str2num(Value);
guidata(h,handles);

% --------------------------------------------------------------------
function varargout = BeatLoPass_str_Callback(h, eventdata, handles, varargin)

global hdr logid
Value = get(h,'String');
set(handles.BeatLoPass_str,'String',Value);
% fprintf(logid,'Writing the value %s to hdr.BeatLoPass\n',Value);
hdr.BeatLoPass = str2num(Value);
guidata(h,handles);

% --------------------------------------------------------------------
function varargout = MinBeat_str_Callback(h, eventdata, handles, varargin)

global hdr logid
Value = str2num(get(h,'String'));
set(handles.MinBeat_str,'String',Value);
fprintf(logid,'Writing the value %4.0f to hdr.min_BPM\n',Value);
hdr.min_BPM = Value;
guidata(h,handles);

% --------------------------------------------------------------------
function varargout = MaxBeat_str_Callback(h, eventdata, handles, varargin)

global hdr logid
Value = str2num(get(h,'String'));
set(handles.MaxBeat_str,'String',Value);
fprintf(logid,'Writing the value %4.0f to hdr.max_BPM\n',Value);
hdr.max_BPM = Value;
guidata(h,handles);

% --------------------------------------------------------------------
function varargout = n_warp_str_Callback(h, eventdata, handles, varargin)

global hdr logid
Value = get(h,'String');
set(handles.n_warp_str,'String',Value);
% fprintf(logid,'Writing the value %s to hdr.n_warp\n',Value);
hdr.n_warp = str2num(Value);
guidata(h,handles);

% --------------------------------------------------------------------
function varargout = Done_Callback(h, eventdata, handles, varargin)

close

